#import "WorkOrderCell.h"

@implementation WorkOrderCell
@synthesize title;
@synthesize description;
@synthesize date;
@synthesize time;
@synthesize background;
@synthesize priority;

- (void) setPriority:(NSInteger)aPriority
{
	priority = aPriority;
	
	switch (priority) {
		case 0:
			background.image = [UIImage imageNamed:@"cell_low.png"];
			break;
		case 1:
			background.image = [UIImage imageNamed:@"cell_medium.png"];
			break;
		case 2:
			background.image = [UIImage imageNamed:@"cell_urgent.png"];
			break;
		default:
			background.image = [UIImage imageNamed:@"cell_neutral.png"];
			break;
	}
}

- (void) setSelected:(BOOL)isSelected animated:(BOOL)animated
{
//	if (animated)
//	{
//		[UIView beginAnimations:nil context:nil];
//		[UIView setAnimationDuration:0.4];
//	}
	
	[super setSelected:isSelected animated:animated];
	if (isSelected)
		background.image = [UIImage imageNamed:@"cell_selected.png"];
	else
		[self setPriority:priority];
	
//	if (animated)
//		[UIView commitAnimations];
}

@end
